<extend name="../Public/base" />
<block name="title"><title>{$TITLE}列表</title></block>
<block name="body">
    <form action="{:U('updateSort')}" method="post">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l"><a href="javascript:;" onclick="layer_show('添加顶级栏目','{:U('add')}','800','500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加顶级栏目</a></span>
        <span class="r"><button class="btn btn-default radius" type="submit"><i class="Hui-iconfont">&#xe68f;</i> 更新{$TITLE}排序</button></span>
    </div>
        <div class="mt-20">注意：目前只支持到3级栏目。</div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg">
            <thead>
                <tr class="text-c">
                    <th width="5%">ID</th>
                    <th width="25%">排序</th>
                    <th width="25%">{$TITLE}名称</th>
                    <th width="25%">描述</th>
                    <th width="5%">显示</th>
                    <th width="15%">操作</th>
                </tr>
            </thead>
            <tbody>
            <volist name="cates" id="info">
                <tr class="text-c">
                    <td>{$info.cate_id}</td>
                    <td class="text-l">
                        <neq name="info.cate_level" value="1">
                            <?php echo str_repeat("&nbsp;",$info['cate_level']*20); ?>
                        </neq>
                        <input class="input-text" name="sorts[{$info.cate_id}]" value="{$info.sort}" type="text" style="width: 180px" /></td>
                    <td class="text-l" style="padding-left:30px;">{$info.cate_name}</td>
                    <td class="text-l">{$info.remark}</td>
                    <td>
                        <eq name='info.status' value='1'>
                            <span class="label label-success radius">显示</span>
                        <else/>
                            <span class="label radius">不显示</span>
                        </eq>
                    </td>
                    <td>
                        <eq name='info.status' value='1'>
                            <a  onclick="category_change_show('{$info.cate_id}')" href="javascript:;" title="取消显示"><i class="Hui-iconfont">&#xe631;</i></a>
                        <else/>
                            <a  onclick="category_change_show('{$info.cate_id}')" href="javascript:;" title="显示"><i class="Hui-iconfont">&#xe615;</i>
                            </a>
                        </eq>
                        <neq name='info.cate_level' value="3">
                            <a title="添加" href="javascript:;" onclick="layer_show('添加子栏目','{:U('add',array('parent_id'=>$info[cate_id],'cate_level'=>$info[cate_level]+1))}','800','500')" class="ml-5">
                                <i class="Hui-iconfont">&#xe600;</i>
                            </a>
                        <else/>
                            <a href="javascript:;" class="ml-20"><i class="Hui-iconfont"></i></a>
                        </neq>

                        <a title="编辑" href="javascript:;" onclick="layer_show('编辑栏目','{:U('edit',array('cate_id'=>$info['cate_id']))}','800','500')" class="ml-5">
                            <i class="Hui-iconfont">&#xe6df;</i>
                        </a>
                        <a title="删除" href="javascript:;" onclick="del('{$info.cate_id}','cate_id')" class="ml-5">
                            <i class="Hui-iconfont">&#xe6e2;</i>
                        </a>
                    </td>
                </tr>
            </volist>
            </tbody>
        </table>
        </div>
    </form>
</block>
<block name="js">
    <script type="text/javascript">
        function category_change_show(id) {
            action('确认要改变显示状态吗？',id,"{:U('changeShow')}",'cate_id');
        }
    </script>
</block>
